<?php

/*

Search (search.pro.php)

*/
ob_start();
$x = 0;

$command[1] = ereg_replace(" ","",$command[1]);

$search = mysql_query("SELECT username,display_name,ip_addr,referer FROM members2 WHERE ip_addr LIKE '%$command[1]%' AND rank > '1' AND game = '$game' ORDER BY ip_addr");
while ($fetchSearch = mysql_fetch_array($search))
{
	$fetchSearch[username] = badwords($fetchSearch[username]);
	$fetchSearch[display_name] = badwords($fetchSearch[display_name]);

	$x++;
	$goTo = "profile";
	$profile = $fetchSearch[username];
	if ($fetchSearch[referer]) { $referrer2 = " - $fetchSearch[referer]"; }
	$searchResults .= "User: <a 	href=user_profile.php?game=$game&user=$fetchSearch[username]>$fetchSearch[display_name]</a> - $fetchSearch[ip_addr]$referrer2<br>";
}

if ($x == "1")
{
	if ($goTo == "profile")
	{
		header("Location: $base_url/user_profile.php?game=$game&user=$profile");
	}
}

if ($x != "1")
{
	print "$openHTML$searchResults$closeHTML";
}

?>